﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using LTorrent.Extensions;

namespace LTorrent.Peers
{
    class BitFieldMessage:IPeerMessages
    {
        

        public Byte[] Message
        {
            get { return _message.ToArray(); }
        }

        protected MemoryStream _message;

        public BitFieldMessage(Byte[] PieceMap)
        {
            _message = new MemoryStream();
            Byte[] Temp = ((UInt32)PieceMap.Length + 1).toNetworkOrder();
            _message.Write(Temp, 0, Temp.Length);
            _message.WriteByte(5);
            _message.Write(PieceMap, 0, PieceMap.Length);
        }


    }
}
